from api.models.user_model import UserModel

class UserService:
    """用户服务"""
    
    @staticmethod
    def create_user(username, email, password_hash, **kwargs):
        """创建用户"""
        user_data = {
            'username': username,
            'email': email,
            'password_hash': password_hash,
            **kwargs
        }
        return UserModel.create(**user_data)
    
    @staticmethod
    def get_all_users():
        """获取所有用户"""
        return UserModel.get_all()
    
    @staticmethod
    def get_user_by_id(user_id):
        """根据ID获取用户"""
        return UserModel.get_by_id(user_id)
    
    @staticmethod
    def update_user(user_id, **kwargs):
        """更新用户信息"""
        return UserModel.update(user_id, **kwargs)
    
    @staticmethod
    def delete_user(user_id):
        """删除用户"""
        return UserModel.delete(user_id)
    
    @staticmethod
    def get_user_by_username(username):
        """根据用户名获取用户"""
        return UserModel.get_by_username(username)
    
    @staticmethod
    def get_user_by_email(email):
        """根据邮箱获取用户"""
        return UserModel.get_by_email(email)